﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace TMIS.DAL
{
    public class TitleSource
    {
        private Model.ThesisDB db = new Model.ThesisDB();

        #region 对题目来源表查询数据功能的实现
        /// <summary>
        /// 获取题目来源表中所有编号的名称
        /// </summary>
        /// <returns></returns>
        public string[] Search()
        {
            string[] code = (from t in db.TitleSource
                                   select t.Code).ToArray();
            return code;
        }

        /// <summary>
        /// 获取指定题目来源对应的ID号
        /// </summary>
        /// <param name="department">题目来源编号</param>
        /// <returns></returns>
        public Guid Search(string code)
        {
            Guid guid = (from t in db.TitleSource
                         where t.Code == code
                         select t.ID).FirstOrDefault();
            return guid;
        }
        #endregion
    }
}
